﻿@{
    ViewBag.Title = "添加栏目";
    Layout = "~/Views/Shared/_Main.cshtml";
}
<div class="form-horizontal">
    <div class="form-group">
        <label for="inputEmail3" class="col-sm-2 control-label">栏目名称</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" id="Name">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-primary" id="save">保存</button>
        </div>
    </div>
</div>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    $('#save').click(function () {

        var Name = $.trim($('#Name').val());

        if (Name == '') {
            alert('请输入栏目名称！');
            return;
        }

        $.ajax({
            cache: false,
            async: false,
            url: '/api/CommonApi?API=Corey_AddColumns',
            type: 'get',
            data: { Name: Name },
            dataType: 'json',
            success: function (data) {
                if (data.Success) {
                    if (confirm('添加成功，是否返回列表？')) {
                        location.href = 'List';
                    } else {
                        $('#Name').val('');
                    }
                }
            }
        });

    });
</script>
